﻿<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>考试中心</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.5.8/css/sm.min.css">
    <link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.5.8/css/sm-extend.min.css">
    <link rel="stylesheet" type="text/css" href="/View_Mobile/UI/KSGL/css/style.css">

</head>
<body ms-controller="UI_USERKSLIST">
    <div class="page-group">
        <!-- 单个page ,第一个.page默认被展示-->
        <div class="page">
            <!-- 标题栏 -->
            <header class="bar bar-nav">
                <a class="icon icon-left pull-left" external></a>
                <h1 class="title">考试中心</h1>
            </header>

            <!-- 这里是页面内容区 -->
            <div class="content infinite-scroll infinite-scroll-bottom">
                <div class="buttons-tab fixed-tab" data-offset="44">
                    <a class="tab-link  button" ms-click="getData(1)" ms-class-1="active:type==1" external>未完成</a>
                    <a class="tab-link button" ms-click="getData(2)" ms-class-1="active:type==2" external>已完成</a>

                </div>

                <div class="tabs">
                    <div class="tab active">
                        <div class="list-block media-list nomargin ">
                            <ul>
                                <li ms-repeat-item="ListData">
                                    <a ms-attr-href="(item.Status==1&&type==2)?'/View_Mobile/UI/KSGL/UI_SJGL.html?ksapid='+item.ID:'/View_Mobile/UI/KSGL/UI_KSAP.html?ksapid='+item.ID" class="item-link item-content " external>
                                        <div class="item-inner">
                                            <div class="item-title-row">
                                                <div class="item-title">{{item.KSName}}{{item.Status==1&&type==2}}</div>
                                                <div class="item-after c-red">{{getstuName(item)}}</div>
                                            </div>
                                            <div class="item-subtitle c999 ft7"><i class="iconfont icon-shijian"></i>{{item.KSDate|date('yyyy-MM-dd HH:mm')}}</div>
                                        </div>
                                    </a>
                                </li>

                            </ul>
                        </div>
                        <p class="no-content" ms-if="loadtip"> {{loadtip}}</p>
                        <div class="infinite-scroll-preloader">
                            <div class="preloader"></div>
                        </div>
                    </div>
                </div>

            </div>
        </div>

    </div>

    <script src="/View_Mobile/JS/layer/layer.m.js"></script>
    <script type='text/javascript' src='//g.alicdn.com/sj/lib/zepto/zepto.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='//g.alicdn.com/msui/sm/0.5.8/js/sm.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='//g.alicdn.com/msui/sm/0.5.8/js/sm-extend.min.js' charset='utf-8'></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
    <script src="/View_Mobile/JS/touch/toucher.js"></script>
    <script src="/View_Mobile/JS/avalon.mobile.min.js"></script>
    <script src="/View_Mobile/JS/raty/jquery.raty.js?v=1.3"></script>
    <script src="/View_Mobile/JS/ComFunJS.js?jsver=20160425"></script>
    <script>
        var model = avalon.define({
            $id: "UI_USERKSLIST",
            ListData: [],
            search: "",
            page: 1,
            loadtip: "",
            loading:false,
            type: 1,
            pagecount: 8,
            GetList: function () {
                if (model.loading) return;
                model.loading = true;
                $.getJSON('/API/VIEWAPI.ashx?Action=KSGL_GETKSAPLIST', { p: model.page, P2: model.type, Content: model.search, myks: "1" }, function (resultData) {
                    model.loading = false;
                    if (resultData.ErrorMsg == "") {
                        if (model.page == 1 && resultData.Result.length == 0) {
                            model.loadtip = '没有找到数据哦'
                        }
                         

                        model.ListData.pushArray(resultData.Result);
                        //判断是否加载完毕
                        if (resultData.Result.length < model.pagecount) {
                            // 加载完毕，则注销无限加载事件，以防不必要的加载
                            $.detachInfiniteScroll($('.infinite-scroll'));
                            // 删除加载提示符
                            $('.infinite-scroll-preloader').hide();
                            return;
                        }
                        $.refreshScroller();
                        model.page += 1;

                    }
                })

            }, getData: function (type) {
                $.attachInfiniteScroll($('.infinite-scroll'))
                model.loadtip = "";
                $('.infinite-scroll-preloader').show();
                model.ListData.clear();
                model.page = 1;
                model.type = type;
                model.GetList();
            }, getstuName: function (item) {
                var StatusName = "";
                switch (item.kszt) {
                    case 1:
                        StatusName = "进行中";
                        break;
                    case 2:
                        StatusName = "未开始";
                        break;
                    case 3:
                        StatusName = "已结束";
                        break;
                }
                switch (item.ISKS) {
                    case "0":
                        StatusName += "-未参加";
                        break;
                    case "1":
                        StatusName += "-已参加未交卷";
                        break;
                    case "2":
                        StatusName += "-已交卷";
                        if (item.ISLSYJ == '') {
                            StatusName += "-正在批阅";
                        }
                        else {
                            StatusName += "-批阅完成";
                        }
                        break;
                }
                return StatusName;
            }
        })
        avalon.ready(function () {
            // 注册'infinite'事件处理函数
            $(document).on('infinite', '.infinite-scroll-bottom', function () {
                model.GetList();
            });
            $.init();

            model.getData(model.type);
        })
    </script>
</body>
</html>
